<?
session_start();

require_once('test_dao.php');

$dao = new DAO; /*Crea la instancia $dao */
$query = "
SELECT
  tbl_Room.RoomID,
  tbl_Room.RoomTypeID,
  tbl_RoomType.Description,
  tbl_RoomType.MaxCapacity,
  tbl_Status.Description,
  tbl_Status.Color
FROM tbl_Room
  INNER JOIN tbl_RoomType ON tbl_Room.RoomTypeID = tbl_RoomType.RoomTypeID
  INNER JOIN tbl_RoomStatus ON tbl_RoomStatus.RoomID = tbl_Room.RoomID
  INNER JOIN tbl_Status ON tbl_RoomStatus.StatusID = tbl_Status.StatusID
WHERE tbl_RoomStatus.Date = CURDATE()

UNION ALL

SELECT
  tbl_Room.RoomID,
  tbl_Room.RoomTypeID,
  tbl_RoomType.Description,
  tbl_RoomType.MaxCapacity,
  (SELECT Description FROM tbl_Status WHERE StatusID = 1),
  (SELECT Color FROM tbl_Status WHERE StatusID = 1)
FROM tbl_Room
  INNER JOIN tbl_RoomType ON tbl_Room.RoomTypeID = tbl_RoomType.RoomTypeID
WHERE tbl_Room.RoomID NOT IN (
  SELECT tbl_RoomStatus.RoomID FROM tbl_RoomStatus WHERE tbl_RoomStatus.Date = CURDATE())
ORDER BY 1 ASC;
"; /* Creo la variable con el query*/

$result=$dao->run_query($query); /* Utilizo el metodo run_query de $dao */

$dao->show_Rooms_table($result);

//$dao->mysql_draw_table($result); /* Dibujo la tabla con el resultado */
 
//echo $dao->fnSQLtoHTML($query);


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Status habitaciones</title>
</head>

<body>
</body>
</html>
